package com.bawei.mall.user.controller;

import com.bawei.common.core.domain.R;
import com.bawei.mall.user.domain.MallProductFootPrint;
import com.bawei.mall.user.service.MallProductFootPrintService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author：HaoYunde
 * @Package：com.bawei.mall.user.controller
 * @Project：mall_cloud
 * @name：MallProductFootPrintController
 * @Date：2024/7/2 16:48
 */
@RestController
@RequestMapping("/member/readHistory")
public class MallProductFootPrintController {

    @Autowired
    private MallProductFootPrintService mallProductFootPrintService;

    /**
     * 足迹表
     * @return
     */
    @GetMapping("/list")
    public R<List<MallProductFootPrint>> readHistory(){
        List<MallProductFootPrint> list=mallProductFootPrintService.readHistory();
        return R.ok(list);
    }


    /**
     * 删除足迹表中的所有数据
     * @return
     */
    @GetMapping("/clear")
    public R deleteAllFootprints() {
        mallProductFootPrintService.deleteAllFootprints();
        return R.ok();
    }

    /**
     * 添加足迹
     * @param mallProductFootPrint
     * @return
     */
    @PostMapping("/create")
    public R create(@RequestBody MallProductFootPrint mallProductFootPrint){
        mallProductFootPrintService.create(mallProductFootPrint);
        return R.ok();
    }



}
